<html>
<head><meta charset="utf-8"><title>type alias · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html">type alias</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212219395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212219395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212219395">(Oct 04 2020 at 11:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20test.20suite.20triage/near/212195550">said</a>:</p>
<blockquote>
<p>493 and 494 are lowering from chalk Alias and Function</p>
</blockquote>
<p>Do aliases even need to be implemented on the chalk side? I think rust-analyzer has working type aliases without them being implemented in chalk</p>



<a name="212230042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212230042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212230042">(Oct 04 2020 at 16:29)</a>:</h4>
<p><span class="user-mention" data-user-id="125131">@detrumi</span> aliases are implemented though?</p>



<a name="212231235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212231235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212231235">(Oct 04 2020 at 17:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20test.20suite.20triage/near/212230042">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> aliases are implemented though?</p>
</blockquote>
<p>Projection and opaque types are, but shouldn't <code>AliasTy::TypeAlias</code> be a thing too?</p>



<a name="212231256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212231256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212231256">(Oct 04 2020 at 17:03)</a>:</h4>
<p>I thought that was the original idea of the alias enum, to have 3 variants</p>



<a name="212232074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212232074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Whitaker <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212232074">(Oct 04 2020 at 17:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20test.20suite.20triage/near/212231235">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20test.20suite.20triage/near/212230042">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> aliases are implemented though?</p>
</blockquote>
<p>Projection and opaque types are, but shouldn't <code>AliasTy::TypeAlias</code> be a thing too?</p>
</blockquote>
<p>I'm not sure if this is right, but I was under the impression that in rustc type aliases are sort of eagerly replaced with their underlying types. So by the time we're doing trait solving they've already been replaced.</p>



<a name="212232915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212232915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212232915">(Oct 04 2020 at 17:42)</a>:</h4>
<p>that's how it works currently, I think the idea was to change that</p>



<a name="212234327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234327">(Oct 04 2020 at 18:11)</a>:</h4>
<p>Is that not <code>Opaque</code>?</p>



<a name="212234418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234418">(Oct 04 2020 at 18:13)</a>:</h4>
<p>Not really, <code>type A = B</code> doesn't really fit as an opaque type, like <code>opaque type A: ? = B</code></p>



<a name="212234475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234475">(Oct 04 2020 at 18:14)</a>:</h4>
<p>Oh, I see</p>



<a name="212234488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234488">(Oct 04 2020 at 18:14)</a>:</h4>
<p>But I'm not sure if chalk actually needs to know about type aliases</p>



<a name="212234489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234489">(Oct 04 2020 at 18:14)</a>:</h4>
<p>Yeah, I mean yeah straight type aliases also are important</p>



<a name="212234499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234499">(Oct 04 2020 at 18:15)</a>:</h4>
<p>If we want to ever be able to add like where clauses to them</p>



<a name="212234563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234563">(Oct 04 2020 at 18:16)</a>:</h4>
<p>There's no RFC for that, I think?</p>



<a name="212234566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234566">(Oct 04 2020 at 18:16)</a>:</h4>
<p>Specifically something like <code>type Foo&lt;T&gt; = Bar&lt;T&gt; where T: Copy</code></p>



<a name="212234573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234573">(Oct 04 2020 at 18:16)</a>:</h4>
<p>No RFC, but it has been discussed recently in the lang meetings</p>



<a name="212234579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212234579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212234579">(Oct 04 2020 at 18:16)</a>:</h4>
<p>I think it would be interesting for some things in rust-analyzer (e.g. using type aliases in inferred types when the user wrote them that way)</p>



<a name="212235995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212235995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212235995">(Oct 04 2020 at 18:50)</a>:</h4>
<p>Another thing to think about (which was brought up in the lang meeting), is that currently something like</p>
<div class="codehilite"><pre><span></span><code>struct Foo&lt;T: Copy&gt; {}
type Bar&lt;T&gt; = Foo&lt;T&gt;;
</code></pre></div>


<p>is allowed.<br>
Though, you could imagine that </p>
<div class="codehilite"><pre><span></span><code>type Bar&lt;T: Copy&gt; = Foo&lt;T: Copy&gt;;
</code></pre></div>


<p>is the most "correct" way to write this.<br>
However, if you consider the former as having some sort of "implied bounds", then I think it makes sense.</p>



<a name="212236215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212236215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212236215">(Oct 04 2020 at 18:54)</a>:</h4>
<p>Right. And that probably gets fun when you combine it with impl trait in type aliases</p>



<a name="212236243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20alias/near/212236243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20alias.html#212236243">(Oct 04 2020 at 18:55)</a>:</h4>
<p>i.e. <code>type Foo = impl Bar</code>, where <code>Foo</code> gets the implied bounds from the hidden type</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>